Ext.onReady(function() {
		Ext.QuickTips.init();
		var tip_label = new Ext.form.Label({
			id:'tip_label',
			xtype : 'label',
			hidden : true
		});
		var login_form = new Ext.form.FormPanel({
			width : 300,
			labelAlign : 'right',
			buttonAlign : 'center',
			frame : true,
			x: '50%',
			y: '10%',
			items : [
			new Ext.form.TextField({
				name : 'username',
				fieldLabel : '姓名',
				allowBlank : false,
				blankText : '请输入姓名',
				regex 	  : /^\d+$/,
				regexText : '用户名只能是数字',
				msgTarget : 'side'
			}), 
			new Ext.form.TextField({
				name : 'password',
				fieldLabel : '密码',
				allowBlank : false,
				blankText : '请输入密码',
				msgTarget : 'side'
			}),
			new Ext.Panel({
					layout : 'border',
					height:23,
					items : [
					new Ext.form.Label({
						width : 100,
						height : 23,
						text:'验证码:',
						style:'text-align:right',
						region:'west'
					}),
					new Ext.form.TextField({
						style:'margin-left:5px',
						width : 30,
						name : 'password',
						fieldLabel : '验证码',
						region:'center'
						}),
					new Ext.form.Label({
						style:'margin-left:15px',
						width : 80,
						height : 23,
						html : '<img src="http://127.0.0.1:8080/NetCourse/safecode" />',
						region:'east'
					})]
				}),
			tip_label
			],
			buttons : [ 
			new Ext.Button({
				text : '提交',
				handler : loadCallBack
			}),
			new Ext.Button({
				text:'重置',
				handler:function(){test();login_form.form.reset();}
			})]
		});
		new Ext.Viewport({
		//	title: 		'viewport',
			layout: 	'absolute',
			appleyTo: 	'container',
			items:[
				login_form
			]
		});
		function loadCallBack() {
			login_form.form.submit({
				url:'http://127.0.0.1:8080/NetCourse/login',
				method:'POST',
				waitMsg:'正在登录',
				success:function(form,action){
					document.location.href=action.result['msg'];
				},
				failure:function(form,action){
					tip_label.getEl().setStyle("display","block");
					tip_label.getEl().setStyle("text-align","center");
					tip_label.getEl().setStyle('color','red');
					tip_label.setText(action.result['msg']);
					tip_label.show();
				}
			});
			}
	});